package com.jzo2o.customer.controller.worker;


import com.jzo2o.customer.model.dto.request.BankAccountUpsertReqDTO;
import com.jzo2o.customer.model.dto.response.BankAccountResDTO;
import com.jzo2o.customer.service.IBankaccountService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

@RestController("BankaccountController")
@RequestMapping("/worker/bank-account")
@Api(tags = "服务端 - 设置银行账户接口设计")
public class BankaccountController {
    @Resource
    private IBankaccountService bankaccountService;

    /**
     * 新增或更新银行账号信息
     *
     * @param bankAccountUpsertReqDTO 银行账户信息
     */
    @ApiOperation("新增或更新银行账号信息")
    @PostMapping
    public void add(@RequestBody BankAccountUpsertReqDTO bankAccountUpsertReqDTO) {
        bankaccountService.add(bankAccountUpsertReqDTO);
    }

    /**
     * 获取当前用户银行账号
     *
     * @return 银行账号信息
     */
    @ApiOperation("获取当前用户银行账号")
    @GetMapping("/currentUserBankAccount")
    public BankAccountResDTO getCurrentUserBankAccount() {
        BankAccountResDTO bankAccountResDTO = bankaccountService.getCurrentUserBankAccount();
        return bankAccountResDTO;
    }

}

